<?php
/* @var $this TopicController */

$this->pageTitle=Yii::app()->name.'-'.$topic->title;
?>

<h1><?=$topic->title?></h1>
<div><?php if($author) echo $author->nickname;?> 发布于<?=$topic->created?></div>
<?php if($isAuthor):?>
<div><a href="<?=$this->createUrl('topic/post',array('id'=>$topic->id,'gid'=>$topic->gid))?>">编辑</a> | <a href="<?=$this->createUrl('topic/delete',array('id'=>$topic->id))?>">删除</a></div>
<?php endif;?>
<div><?=$topic->content?></div>
<h5>评论</h5>
<?php foreach($commentList as $item):?>
	<div>
		<?=$item->user->nickname?>在 <?=$item->addtime?> 说道：<br /><?=$item->content?>
<?php if(!Yii::app()->user->isGuest && Yii::app()->user->id == $item->uid):?>
		<a href="<?=$this->createUrl('comment/delete',array('id'=>$item->id))?>">删除</a>
<?php endif;?>
	</div>
<?php endforeach;?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm',array(
	'id'=>'comment-form',
	'action'=>$this->createUrl('comment/post',array('tid'=>$topic->id)),
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
));?>
<div class="row">
	<?php echo $form->label($comment,'content');?>
	<?php echo $form->textArea($comment,'content');?>
	<?php echo $form->error($comment,'content');?>
</div>

<div class="row buttons">
	<?php echo CHtml::submitButton('发布');?>
</div>
<?php $this->endWidget();?>
</div><!--form-->
